package com.liruo.enumconverter.test.web.config;

import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
@EnableKnife4j
public class Swagger2Configuration {
    @Bean
    public Docket docket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(new ApiInfoBuilder()
                        .title("网址收藏站")
                        .description("统一管理网址")
                        .termsOfServiceUrl("https://github.com/liruohrh")
                        .contact(new Contact("liruo","https://github.com/liruohrh","xxx@qq.com"))
                        .version("1.0")
                        .build())
                .enable(true)
                .groupName("v1")
                .select()
                // 过滤路径
//                .paths(PathSelectors.a())
                // 指定扫描的包
                .apis(RequestHandlerSelectors.basePackage("com.liruo.enumconverter.test.web.controller"))
                .build();
    }
}